package au.org.arcs.dss.provider.datasource.provider.factory;

import au.org.arcs.dss.provider.datasource.provider.DataSourceProvider;

/**
 *
 * @author ming
 */
public abstract class DataSourceProviderFactory {
  private static IRODSDataSourceProviderFactory irodsDataSourceProviderFactory;
  private static StubDataSourceProviderFactory stubDataSourceProviderFactory;

  public abstract DataSourceProvider getDataSourceProvider();

  public static DataSourceProviderFactory getDataSourceProviderFactory(DataSourceProviderType dataSourceProviderType) {
    switch (dataSourceProviderType) {
      case IRODS_DATA_FABRIC:
        if (irodsDataSourceProviderFactory == null) {
          irodsDataSourceProviderFactory = new IRODSDataSourceProviderFactory();
        }
        return irodsDataSourceProviderFactory;

      case STUB:
        if (stubDataSourceProviderFactory == null) {
          stubDataSourceProviderFactory = new StubDataSourceProviderFactory();
        }
        return stubDataSourceProviderFactory;

      default:
        return null;
    }
  }
}
